<%@page import="org.hibernate.validator.constraints.SafeHtml.Tag"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>项目产品详情</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
  <div>
  <input id="prdmarks" value="" style="display:none"/>
<div id="pageInTab" class="pageInTab">
   	 	<form id="basePrdForm1">
    	<div tabid="tabA" title="产品基本信息" lselected="true">
       			<div class="fieldset1 tabel_col clearFix">
       			  <div class="caption">
                                <span class="title">主车配置</span>
                    </div>
               		 <div style="display: none">
               		 	<input name="prdId" id="prdId"  type="hidden"  value="${prdBscInfo.id}"   class="ui-textbox"  disabled="disabled">
               		  	<input name="prdbscInfoId" id="prdbscInfoId"  type="hidden"  value=""   class="ui-textbox"  disabled="disabled">
               		 </div>
               		 		<div class="fieldBox col_33" >
	                        	<div class="label">产品名称</div>
				                <div class="field">
				                	<input name="prdNm"  id="prdNm" type="text"  value="${prdBscInfo.prdNm}"  class="ui-textbox"  readonly="readonly">
				                </div>
				           </div>
				           	<div class="fieldBox col_33" >
	                        	<div class="label">产品类型</div>
				                <div class="field">
				                	<input name="prdTypCdNm" id="prdTypCdNm" type="text"  value="${prdBscInfo.prdTypCdNm}"  class="ui-textbox"  readonly="readonly">
				                	<input name="prdTypCd" id="prdTypCd"  type="hidden"  value="${prdBscInfo.prdTypCd}"  class="ui-textbox"  >
				                </div>
				           </div>
				           	<div class="fieldBox col_100" >
	                        	<div class="label">产品备注</div>
				                <div class="field">
				                <span style="color: red">请按照以下规则维护备注信息：<br/>合同号：**********，流程编号：*********；</span>
								<textarea id="mOthInfo" name="mOthInfo" class="l-textarea" rows="4" style="width:99%"  validate="{required:true}"></textarea>			
							    <span class="requiredSymbol">*</span>
							    </div>
				           </div>
				             <div class="caption">
                                <span class="title">项目相关信息</span>
                   		  </div>
                   		
                        <div class="fieldBox col_33">
                    <div class="label">参考价（元）</div>
                    <div class="field">
                        <input id="guidePc" name="guidePc" type="text"  class="ui-textbox"  value=""   onchange="guidePcChange()" validate="{number: true,required:true}"/>
                     <span class="requiredSymbol">*</span>
                    </div>
                </div>
                    <div class="fieldBox col_33">
                    <div class="label">数量</div>
                    <div class="field">
                        <input id="prdQty" name="prdQty" type="text"  class="ui-textbox"  value="" onchange="guidePcChange()" validate="{number: true,required:true}"/>
                     <span class="requiredSymbol">*</span>
                    </div>
                </div>
                  <div class="fieldBox col_33">
                    <div class="label">设备款合计（元）</div>
                    <div class="field">
                        <input id="prdAmt" name="prdAmt" type="text"  class="ui-textbox"  value="" readonly="readonly"/>
                    </div>
                </div>
                   <div class="fieldBox col_33">
                    <div class="label">每台设备留购价（元）</div>
                    <div class="field">
                        <input id="rsrvPc" name="rsrvPc" type="text"  onblur="checkAmt();"   class="ui-textbox"  value="" validate="{number: true,required:true}"/>
                     <span class="requiredSymbol">*</span>
                    </div>
                </div>
                <div class="fieldBox col_33" id="irrPctText">
                    <div class="label">实际收益率</div>
                    <div class="field">
                        <input id="irrPct" name="irrPct" type="text"  class="ui-textbox"  value="" validate="{number: true}"/>%
                    </div>
                </div>
               <div class="fieldBox col_50">
                    <div class="label">供应商</div>
                    <div class="field">
                        <input name="splId"  id="splId"  type="text"  value="" placeholder="请选择"   onchange="getSplAccNos();"  ltype="combobox"  validate="{required:true}">
                         <span class="requiredSymbol">*</span>
                         <span id="addBtnSpl" class="sq-button sq-button-round" style="margin-left:22px" onclick="addSpl()">新增</span>
                         <div class="combo_itemList_wrap"></div>
                    </div>
                </div>
                <!-- 供应商ID -->
                 <div class="fieldBox col_50" >
                    <div class="label">供应商账号</div>
                    <div class="field">
                  		   <input name="splAccNoId"  id="splAccNoId"  type="text"  value="" placeholder="请选择"    ltype="combobox"  validate="{required:true}">
                         <span class="requiredSymbol">*</span>
                         <span id="addBtnSplAccNo" class="sq-button sq-button-round" style="margin-left:22px" onclick="addSplAccNo()">新增</span>
                         <div class="combo_itemList_wrap"></div>
                    </div>
                </div>
                 	<div class="fieldBox col_33" id="isHaveBckNo" style="display: none">
	                    <div class="label">是否有返利账号</div>
	                    <div class="field">
	                    	 <select id="isBckNo" name="isBckNo" onchange="setSplBackBankShow()">
	                    	             <option value="">--请选择--</option>
				                    	<c:forEach items="${yesNoCdList}" var="yesFlag">
				                    		<option value="${yesFlag.key }" 
				                    		<c:if test="${hasSplBackNo==yesFlag.key}">
				                    		selected="selected"
				                    		</c:if>
				                    		>${yesFlag.value }</option>
				                    	</c:forEach>
	                  		</select>
	                    </div>
	                </div>
                   <!-- 供应商返利ID -->
                 <div class="fieldBox col_50"  id="splBckBankAccDiv"  style="display: none">
                    <div class="label">供应商返利账号</div>
                    <div class="field">
                  		   <input name="splBackBankNoId"  id="splBackBankNoId"  type="text"  value="" placeholder="请选择"  ltype="combobox"  >
                         <span class="requiredSymbol" id="splBackBankValidate" style="display: none">*</span>
                         <span id="addBtnSplBankAccNo" class="sq-button sq-button-round" style="margin-left:22px" onclick="addSplAccNo()">新增</span>
                         <div class="combo_itemList_wrap"></div>
                    </div>
                </div>
                </div>
	</div>
   </form>
	 
	 <div id="btnsBox" class="btnsBox">
			<span id="saveBtn" class="sq-button sq-button-round" onclick="savePrjBscInfo()"><!-- <i class="sqBtnIco_10"></i> -->保存</span>
           <span id="cancelBtn" class="sq-button sq-button-round" onclick="cancelBtn()"><!-- <i class="sqBtnIco_14"></i> -->取消</span>
	 </div>
	 </form>
</div>
</div>
</div>


<script type="text/javascript">
var prjId="${prjId}";
var detailFlag = '${detailFlag}';
var splBanNo = '${splBanNo}';
var id="${id}";
var beforePrdQty = '';
var beforeGuidePc = ''; 
var beforeRsrvPc = ''; 
var searchSplNm = '';
var buOrgCd = '${buOrgCd}';
var prjTypCd = '${prjTypCd}';//项目类型
var insCode = '${insCode}';//机构代码
var hasSplBackNo = '${hasSplBackNo}';
var _rcCstBscInfoId = '';
$(function () {
	 var basePrdForm1 = liger.get("basePrdForm1");
	var form = $("#basePrdForm1").ligerForm({
		validate: true
    });
	 $("#basePrdForm1").check_ligerFormEditor();
			initData();
			if(detailFlag=="true"){
				$("#saveBtn").hide();
				$("#cancelBtn").hide();
				$("#addBtnSpl").hide();
				$("#addBtnSplAccNo").hide();
				$("#addBtnSplBankAccNo").hide();
				if(liger.get("splAccNoId")&&liger.get("splAccNoId")!="undefined"){
					liger.get("splAccNoId").setDisabled(true);
				}
				if(liger.get("splBackBankNoId")&&liger.get("splBackBankNoId")!="undefined"){
					liger.get("splBackBankNoId").setDisabled(true);
				}
				if(liger.get("guidePc")&&liger.get("guidePc")!="undefined"){
					liger.get("guidePc").setDisabled(true);
				}
				if(liger.get("prdAmt")&&liger.get("prdAmt")!="undefined"){
					liger.get("prdAmt").setDisabled(true);
				}
				if(liger.get("rsrvPc")&&liger.get("rsrvPc")!="undefined"){
			 		liger.get("rsrvPc").setDisabled(true);
				} 
				if(liger.get("prdQty")&&liger.get("prdQty")!="undefined"){
					liger.get("prdQty").setDisabled(true);
				}
				if(liger.get("irrPct")&&liger.get("irrPct")!="undefined"){
					liger.get("irrPct").setDisabled(true);
				}
				if(liger.get("isBckNo")&&liger.get("isBckNo")!="undefined"){
					liger.get("isBckNo").setDisabled(true);
				}
				if(liger.get("splId")&&liger.get("splId")!="undefined"){
					liger.get("splId").setDisabled(true);
					}
				if($("#mOthInfo")&&$("#mOthInfo")!="undefined"){
					$("#mOthInfo").setDisabled_ligerTextarea(true);
				}
			}
			 if(buOrgCd==ProjectConstant.CODE_BU_ORG_CD_ZK){
				 $("#isHaveBckNo").show();
				 if(hasSplBackNo==1){
					 $("#splBckBankAccDiv").show();
				 }
			 }
})

function addSpl(){
	var prdmarks = $("#prdmarks").val();
        //弹出框校验供应商是否已存在
        $.ligerDialog.SQopen({
            width: 600,
            height:180,
            title : '请填写供应商名称和税务登记号',
            url:'<%=path%>/product/splInfo/toCheckSplPage.do?lxxz='+true+'&prdmarks='+prdmarks,
            buttons: [{
                	text: "确定", type: 'ok', cls: 'l-dialog-btn-ok',
	                onclick: function (item, Dialog) {
	                    if (Dialog.onOk) Dialog.onOk();
	                }
	            }, {
	                text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
	                onclick: function (item, Dialog) {
	                    if (Dialog.onCancel) Dialog.onCancel();
	                }
	            }
        	]

        });
	}
	
function addSplAccNo(){
	var _id = $("#splId_val").val();
	if(!_id)return;
	Add_navTab('PrdSpl_4'+_id,'供应商账号',"<%=path%>/product/splBank/toListPage.do?splId="+_id+"&lxxz="+true);
}	

function checkAmt(){
var checkRsrvPc;
	var _url ='<%=path%>/project/prjprdbscinfo/checkRsrvPc.do';
   	var params = {};
   	if(!checkRsrvPc){
	   	$.ajax({
	   		type: 'get',
	   		dataType:'json',
	   		data:params,
	   		url: _url,
	   		success:function(msg){
	   			 if(msg.success == 1){
	   				checkRsrvPc = msg.data;
	   				if(checkRsrvPc){
	   					checkRsrvPc = checkRsrvPc/100;
	   					var rsrvPc = $("#rsrvPc").val();
	   					if(rsrvPc<checkRsrvPc){
	   						 top.$.ligerDialog.SQalert({content: "留购价不能小于100",SQ_type: "error"});
	   					}
	   				}
	   			 }else{
	   				 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	   			 }
	   		}
	   	});
   	}

}

 var audStsCdList = new Array();
		if(buOrgCd!=ProjectConstant.CODE_BU_ORG_CD_CAR){
			   audStsCdList.push(CommonConstant.C_AUD_ADNWAY_CODE);
			}
	audStsCdList.push(CommonConstant.C_AUD_PASS_CODE);
	var audStsCdListArr = JSON.stringify(audStsCdList);

	function initData(){
		//默认数量为1
		var prdQty = $("#prdQty").val();
		if(prdQty==""){
			$("#prdQty").val("1");
		}
		if(insCode==ProjectConstant.PRJ_INS_CODE_ICBC){
			$("#rsrvPc").removeAttr("onblur");
			$("#rsrvPc").val(0);
		}
		var rsrvPc = $("#rsrvPc").val();
		if(rsrvPc==""){
			$("#rsrvPc").val("100");
		}
		
		if(id){
			var basePrdInfo = '${prdBscInfoVO}';
			      basePrdInfo = JSON.parse(basePrdInfo);
			  if(basePrdInfo){
					var carInfo = basePrdInfo.prjPrdCarInfoVO; //乘用车明细数据
			    	var tkInfo = basePrdInfo.prjPrdTkInfoVO; //卡车明细数据
			    	 var basePrdForm1 = liger.get("basePrdForm1");
			     	 basePrdForm1.setData({
			    		 prdNm: basePrdInfo.prdNm,
			    		 prdClsCdNm: basePrdInfo.prdClsCdNm,
			    		 prdTypCd: basePrdInfo.prdTypCd,
			    		 brCdNm:basePrdInfo.brCdNm,
			    		 brCd: basePrdInfo.brCd,
			    		 prdMdl: basePrdInfo.prdMdl,
			    		 prdMdlSun: basePrdInfo.prdMdlSun,
			    		 mfrId: basePrdInfo.mfrId,
			    		 mfrNm: basePrdInfo.mfrNm,
			    		 prdRem: basePrdInfo.prdRem,
			    		 audStsCd: basePrdInfo.audStsCd,
			    		 prdTypCdNm: basePrdInfo.prdTypCdNm,
			    		 isNew :basePrdInfo.isNew ,
			    		 usedPd :basePrdInfo.usedPd ,
			    		 secUsedPd :basePrdInfo.usedPd ,
			    		 rsrvPc :basePrdInfo.rsrvPc , 
			    		 guidePc :basePrdInfo.guidePc,
			    		 prdQty :basePrdInfo.prdQty ,
			    	/* 	 prdUntCd :basePrdInfo. prdUntCd, */
			    		 prdAmt :basePrdInfo.prdAmt ,
			    		 prdUseCd :basePrdInfo.prdUseCd ,
			    		 prdRem :basePrdInfo.prdRem ,
			    		 irrPct :basePrdInfo.irrPct ,
			    		// prdLnkComp:basePrdInfo.lnkCompRList,
			    		 prdbscInfoId:basePrdInfo.id,
			    		 usedPd:basePrdInfo.usedPd,
			    		 prdAmt:basePrdInfo.prdAmt,
			    		 certDt:basePrdInfo.certDt,
						 invAmt:basePrdInfo.invAmt,
						 splId:basePrdInfo.splId,
						 prdId:basePrdInfo.prdId,
						 guidePc:basePrdInfo.guidePc,
						 splAccNoId:basePrdInfo.splAccNoId,
						 //
						 certDt:basePrdInfo.certDt,
						 invAmt:basePrdInfo.invAmt,
						 deprRate:basePrdInfo.deprRate,
						 deprAmt:basePrdInfo.deprAmt,
						 prdDtlId:basePrdInfo.prdDtlId
			         }); 
			     	 if(StringUtils.isNotEmpty(basePrdInfo.ctrValue)){
			     		if(liger.get("prdQty")&&liger.get("prdQty")!="undefined"){
							liger.get("prdQty").setDisabled(true);
						} 
			     	 }
			     	 $("#mfrId").val(basePrdInfo.mfrId);
			     	 $("#brCd").val(basePrdInfo.brCd);
			     	 $("#carId").val(basePrdInfo.id);
			     	 $("#tkId").val(basePrdInfo.id);
			     	 $("#isNew").val(basePrdInfo.isNew);
			     	 $("#prdId").val(basePrdInfo.prdId);
			     	 $("#prdDtlId").val(basePrdInfo.prdDtlId);
			    	 $("#prdbscInfoId").val(basePrdInfo.id);
			    	 $("#prdTypCd").val(basePrdInfo.prdTypCd);
			    	 searchSplNm = basePrdInfo.splNm;
			     	var guidePc = $("#guidePc").ligerGetTextBoxManager().getValue();
			    	var prdQty = $("#prdQty").ligerGetTextBoxManager().getValue();
				    var total = NumberUtils.mul(guidePc,prdQty);
				    $("#total").text(total);
				   	    beforePrdQty = prdQty;
				   		beforeGuidePc = guidePc;
				   		beforeRsrvPc = $("#rsrvPc").val();
			     	  basePrdForm1 = liger.get("basePrdForm1");
			     	if(null!=tkInfo){
			     		$("#prdmarks").val("tk");
			     		basePrdForm1.setData({
			     	   	prdId: tkInfo.prdId,
			     	   drvTyp: tkInfo.drvTyp,
			     	  engMdl: tkInfo.engMdl,
			     	 hp: tkInfo.hp,
			     	emiStd: tkInfo.emiStd,
			     	cabSpec: tkInfo.cabSpec,
			     	prdMdlSun: tkInfo.prdMdl,
			     	grboxMdl: tkInfo.grboxMdl,
			     	rearAxleSpec: tkInfo.rearAxleSpec,
			     	mWhlSpec: tkInfo.mWhlSpec,
			     	 prdClsCd: tkInfo.prdClsCd,
		    		 prdCd: tkInfo.prdCd,
		    		 //prdMdl: basePrdInfo.prdMdl,
			     	cntrSz: tkInfo.cntrSz,
			     	actCntrSz: tkInfo.actCntrSz,
			     	thickness: tkInfo.thickness,
			     	axleInfo: tkInfo.axleInfo,
			     	matQalCd: tkInfo.matQalCd,
			     	liftWayCd: tkInfo.liftWayCd,
			     	doorInfo: tkInfo.doorInfo,
			     	isHvWhl: tkInfo.isHvWhl,
			     	trlWhlSpec: tkInfo.trlWhlSpec,
			     	cylSepc: tkInfo.cylSepc,
			     	tankVol: tkInfo.tankVol,
			     	othInfo: tkInfo.othInfo,
			     	tkId:tkInfo.id,
			     	brTypCd:tkInfo.brTypCd,
			     	buyWayCd:tkInfo.buyWayCd,
			     	prdClsCd:tkInfo.prdClsCd,
			     	emiStd:tkInfo.emiStd,
			     	gasCylSpec:tkInfo.gasCylSpec,
			     	saddleSpec:tkInfo.saddleSpec,
			     	isHvAirCnd:tkInfo.isHvAirCnd,
			     	whlBase:tkInfo.whlBase,
			     	isHvSub:tkInfo.isHvSub,
			     	batDeg:tkInfo.batDeg,
			     	seatRowCd:tkInfo.seatRowCd,
			     	clsExfPc:tkInfo.clsExfPc,
			     	mOthInfo:tkInfo.mOthInfo,
			     	fuelTypCd:tkInfo.fuelTypCd
			            });
			     		 $("#tkId").val(tkInfo.id);
			     		if(liger.get("drvTypCd")&&liger.get("drvTypCd")!="undefined"){
			     		    liger.get("drvTypCd").setValue(tkInfo.drvTyp);
			     		}
			     	} 
			  }
		  
		}
		
		var guidePc = $("#guidePc").val();
    	var prdQty = $("#prdQty").val();
		if(guidePc&&prdQty){
		    //设置小计值
			guidePcChange();
		}
    }
    //设置小计值
    function guidePcChange(){
    	var guidePc = $("#guidePc").ligerGetTextBoxManager().getValue();
    	var prdQty = $("#prdQty").ligerGetTextBoxManager().getValue();
    	 var total =0;
    	if(guidePc&&prdQty){
	     total = NumberUtils.mul(guidePc,prdQty);
    	}
	    $("#total").text(total);
	    $("#prdAmt").val(total);
    }
    
     var comboGrid_defaultValue1='${splId}';
     var comboGrid_defaultText1 = '${splNm}';
     var isInit_setSearchComboVal1 = false;
    var COMBO_SPL = $("#splId").ligerComboBox({
        width: 300,
        selectBoxWidth: 300,
        selectBoxHeight: 240,
        valueField: 'id',
        textField: 'splNm',
        isMultiSelect: true,
        isSingleCheck: true,
        grid: getSplGridOptions(true),
        parms: {condition:JSON.stringify([{"op":"like","field":"splNm","value": comboGrid_defaultText1,"type":"text"}])},
        condition: {
            labelWidth: 0,
            space: 5,
            fields: [{ name: 'splNm', width: 90, type:'text' , keyName: 'id'}]
        },
        delayLoadGrid: false,
        onChangeValue: function (value) {
            if (COMBO_SPL) {
            	if (value=="" && COMBO_SPL.getValue()=='') comboGrid_defaultValue1 = ""; //如果点击清空'x'，就滞空初始值
                $("#splId").show_ligerComboItems(".combo_itemList_wrap");
            };
            var _selected = this.gridManager.getSelected()
            var rcId = _selected && _selected.rcCstBscInfoId;
            if(typeof(rcId) != "undefined" && rcId!=null){
            	_rcCstBscInfoId = rcId;
            }
            SetIframe_height();
        }
    });
  //供应商
  liger.get("splNm").setValue(searchSplNm);
 	var selectSplNm =  liger.get("splNm").getValue();
    function getSplGridOptions(checkbox){
    	var _prjId = '${prjId}';
        var options = {
            columns: [
                { display: '供应商名称', name: 'splNm',
                	render: function (rowdata, rowindex, value, column) { 
	            		 value ==null?"":value;
	            		var h = '';
	            		var audStsCd = rowdata.audStsCd;
	            		if(audStsCd){
	            		  if(audStsCd==FlowConstant.FLOW_CHECK_STATE_NON||audStsCd==FlowConstant.FLOW_CHECK_STATE_IN){
		                    	h+='<i class="ico_flasher"></i>';
		                    }
	            		}
	                        h+=value;
	                        return h;
	            	},
                	minWidth: 150 },
                { display: '企业性质', name: 'corpTypCdNm', minWidth: 100 },
                { display: '经营范围', name: 'bizScope', minWidth: 150 },
                { display: '注册资本', name: 'regCapAmt', minWidth: 50 },
                { display: '实收资本', name: 'paidCapAmt', minWidth: 50 },
            ],
            switchPageSizeApplyComboBox: false,
            url: '<%=path%>/project/prjprdbscinfo/splInitList.do?audStsCdList='+audStsCdListArr+'&prjId='+_prjId,
            method: 'get',
            dataAction: 'local',
            root:'rows',
	        record:'total',
            pageSize: 10,
            usePagerOnLessPagesize: false,
            cssClass: "SMALL_grid",
           // checkbox: checkbox,
            isSingleCheck: true,
            frozen: false,
            isSelected: function (rowdata) {
                if (comboGrid_defaultValue1 == "") return false;
                var defaultItems = comboGrid_defaultValue1.split(";");
                if(!isInit_setSearchComboVal1) { //只在初始化时执行一次，在onAfterShowData后改变
                    for (var i = 0; i < defaultItems.length; i++) {
                        if(rowdata[COMBO_SPL.options.valueField] == defaultItems[i]) {
                            return true;
                        }
                    };
                };
                return false;
            },
            onAfterShowData: function (currentData) {
                if(!isInit_setSearchComboVal1) { //只在初始化时执行一次，在onAfterShowData后改变
                	COMBO_SPL.setInputValue(comboGrid_defaultValue1, comboGrid_defaultText1, true);
                    isInit_setSearchComboVal1 = true;
                }
            }
        };
        return options;
    }
  
  //取消
	function cancelBtn(){
		  var TAB=top.mainApp.parentTab;
          var currentTabid=TAB.getSelectedTabItemID();
		 top.tab.removeTabItem(currentTabid);
	}
  
  function savePrjBscInfo(){
	  var ligerForm = liger.get("basePrdForm1");
	     if (!ligerForm.valid()) {
	            top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
	            return false; //验证不通过，不执行以下代码
	       }
	  var guidePc = $("#guidePc").ligerGetTextBoxManager().getValue();
  	var prdQty = $("#prdQty").ligerGetTextBoxManager().getValue();
  	var prdbscInfoId = $("#prdbscInfoId").val();
  	var rsrvPc = $("#rsrvPc").val();
  	if(guidePc&&prdQty&&prdbscInfoId&&rsrvPc){
  		if(guidePc!=beforeGuidePc||beforePrdQty!=prdQty||rsrvPc!=beforeRsrvPc){
  			var _ids = [];
  			_ids.push(prdbscInfoId);
  			var params = {};
			params.prjId=prjId;
			params.ids = JSON.stringify(_ids);
				$.ajax({
				type: 'get',
				dataType:'json',
				data:params,
				url: '<%=path%>/project/prjprdbscinfo/checkPrjPrdDtlExist.do',
				success:function(msg){
					 if(msg.data==true){
						    $.ligerDialog.SQalert({
				                SQ_showButtons: true,
				                SQ_onBtnclick: function (item, Dialog) {
				                	$("#removeFlag").val(CommonConstant.C_YN_Y);
									save();
				                },
				                content: "已经存在支付表信息，确定删除已经拆分的支付表,修改数量和指导价信息吗？"
				            });
						 
						}else{
							$("#removeFlag").val(CommonConstant.C_YN_N);
							save();
						}
					
					}
							
			});
  	  	}else{
  	  	$("#removeFlag").val(CommonConstant.C_YN_N);
  	  		save();
  	  	}
  	}else{
  		$("#removeFlag").val(CommonConstant.C_YN_N);
  		save();
	}
  	
  }
  
	//保存项目基础信息
	function save(){
        var ligerForm = liger.get("basePrdForm1");
        if (!ligerForm.valid()) {
            top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
      
        var splNm = $("#splId").val();
        var data = ligerForm.getData();
        var prjId = '${prjId}';
    	var rcCstBscInfoId = _rcCstBscInfoId;
        data["prjId"] = prjId;
        data["splNm"] = splNm;
        data["prdId"]=$("#prdId").val();
        data["prdQty"]=$("#prdQty").val();
        data["prdbscInfoId"] = $("#prdbscInfoId").val();
        data["removeFlag"] = $("#removeFlag").val();
        data["rcCstBscInfoId"] = rcCstBscInfoId;
        data["prdTypCd"] = $("#prdTypCd").val();
        data["prdCd"] = $("#prdTypCd").val();
        var accNoArr = [];
        var accNo1 = {};
        accNo1.splAccNoId=$("#splAccNoId").ligerComboBox().getValue();
        accNo1.purpCd = 1;
        accNoArr.push(accNo1);
        var  backNo = $("#splBackBankNoId").val();
        if(backNo&&buOrgCd==ProjectConstant.CODE_BU_ORG_CD_ZK){
        var accNo2 = {};
        accNo2.splAccNoId=$("#splBackBankNoId").ligerComboBox().getValue();
        accNo2.purpCd = 2;
        accNoArr.push(accNo2);
        }
        data["bankAccNoList"]=JSON.stringify(accNoArr);
        var url = '<%=path%>/project/prjbscinfo/addPrdAndPrdDetail.do';
        var wait_dialog;
        $.ajax({
    		type: 'post',
    		dataType:'json',
    		data:data,
    		url: url,
    		beforeSend: function(){
		          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
		     },
    		success:function(msg){
    			 if(msg.success == 1){
    				 wait_dialog.close();
    				 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
    					var TAB=top.mainApp.parentTab;
			            var currentTabid=TAB.getSelectedTabItemID();
			            var currFrameElement=top.$("#"+currentTabid).get(0);
						 var callback=currFrameElement.W2W.callback;
		          	  		callback();
		          	 	 top.tab.removeTabItem(currentTabid); 
    			 }else{
    				 wait_dialog.close();
    				 UIUtils.alertError(msg.info);
    			 }
    		}
    	});
	}
   function getSplBankNo(){
	    	var splId =liger.get("splId").selectedValue;
	    	if(splId==undefined){
	    		return;
	    	}
	    	var bankId='${accId}';
	    	var audStsCdList = new Array();
			//audStsCdList.push(CommonConstant.C_AUD_NO_HAPPEN_CODE);
			if(buOrgCd!=ProjectConstant.CODE_BU_ORG_CD_CAR){
			   audStsCdList.push(CommonConstant.C_AUD_ADNWAY_CODE);
			}
			audStsCdList.push(CommonConstant.C_AUD_PASS_CODE);
			var audStsCdListArr = JSON.stringify(audStsCdList);
	        $.ajax({
	            url: '<%=path%>/project/prjprdbscinfo/getSplBankAccNoBySplId.do?splId='+splId+'&&audStsCdList='+audStsCdListArr,
	            dataType:'json',
	            success: function (res) {
	                var splAccNoId = liger.get('splAccNoId');
	                splAccNoId.gridManager.loadData(res);
	                splAccNoId.clear();
	                if(bankId){
	                  splAccNoId.setValue(bankId);
	                }
	            }
	        });
   }

   		
   var comboGrid_defaultValue2='${accId}';
   var comboGrid_defaultText2 = '${accNo}';
   var isInit_setSearchComboVal2 = false;
  var COMBO_BANK = $("#splAccNoId").ligerComboBox({
      width: 300,
      selectBoxWidth: 300,
      selectBoxHeight: 240,
      valueField: 'id',
      textField: 'accNo',
      isMultiSelect: true,
      isSingleCheck: true,
      grid: getBankNoGridOptions(true),
      delayLoadGrid: false
  });
  
  function getBankNoGridOptions(checkbox){
  	var splId =liger.get("splId").selectedValue;
      var options = {
          columns: [
              { display: 'id', name: 'id', minWidth: 150,hide:true },
              { display: '收款人', name: 'rcptUnt', 
          		render: function (rowdata, rowindex, value, column) { 
           		 value ==null?"":value;
           		var h = '';
           		if(rowdata.audStsCd){
           		  if(rowdata.audStsCd==FlowConstant.FLOW_CHECK_STATE_NON||rowdata.audStsCd==FlowConstant.FLOW_CHECK_STATE_IN){
	                    	h+='<i class="ico_flasher"></i>';
	                 }
           		}
                   h+=value;
                       return h;
           	},
            	  minWidth: 150 },
              { display: '对公/对私', name: 'bizTypCdNm', minWidth: 50 },
              { display: '收款账号', name: 'accNo', minWidth: 100 },
              { display: '开户银行', name: 'bkNm', minWidth: 150 },
              { display: '开户行号', name: 'bkNo', minWidth: 50 },
              
          ],
          switchPageSizeApplyComboBox: false,
          //url: '<%=path%>/project/prjprdbscinfo/getSplBankAccNoBySplId.do?splId=splId&&audStsCd='+FlowConstant.FLOW_CHECK_STATE_PASS+'&&purpCd=1',
          method: 'get',
          data:null,
          dataAction: 'local',
          root:'rows',
	        record:'total',
          pageSize: 10,
          usePagerOnLessPagesize: false,
          cssClass: "SMALL_grid",
         // checkbox: checkbox,
          isSingleCheck: true,
          frozen: false,
          isSelected: function (rowdata) {
              if (comboGrid_defaultValue2 == "") return false;
              var defaultItems = comboGrid_defaultValue2.split(";");
              if(!isInit_setSearchComboVal2) { //只在初始化时执行一次，在onAfterShowData后改变
                  for (var i = 0; i < defaultItems.length; i++) {
                      if(rowdata[COMBO_BANK.options.valueField] == defaultItems[i]) {
                          return true;
                      }
                  };
              };
              return false;
          },
          onAfterShowData: function (currentData) {
              if(!isInit_setSearchComboVal2) { //只在初始化时执行一次，在onAfterShowData后改变
              	COMBO_BANK.setInputValue(comboGrid_defaultValue2, comboGrid_defaultText2, true);
                  isInit_setSearchComboVal2 = true;
              }
          }
      };
      return options;
  }	
		
  
  
  
  //供应商返利账号
   function getSplBackBankNo(){
	    	var splId =liger.get("splId").selectedValue;
	    	if(splId==undefined){
	    		return;
	    	}
	    	var backAccId='${backAccId}';
	    	var audStsCdList = new Array();
			if(buOrgCd!=ProjectConstant.CODE_BU_ORG_CD_CAR){
			   audStsCdList.push(CommonConstant.C_AUD_ADNWAY_CODE);
			}
			audStsCdList.push(CommonConstant.C_AUD_PASS_CODE);
			var audStsCdListArr = JSON.stringify(audStsCdList);
	        $.ajax({
	            url: '<%=path%>/project/prjprdbscinfo/getSplBankAccNoBySplId.do?splId='+splId+'&&audStsCdList='+audStsCdListArr+'&&purpCd=2',
	            dataType:'json',
	            success: function (res) {
	                var splBackBankNoId = liger.get('splBackBankNoId');
	                splBackBankNoId.gridManager.loadData(res);
	                splBackBankNoId.clear();
	                if(backAccId){
	                	splBackBankNoId.setValue(backAccId);
	                }
	            }
	        });
   }
   var comboGrid_defaultValue3='${backAccId}';
   var comboGrid_defaultText3 = '${backAccNo}';
   var isInit_setSearchComboVal3 = false;
  var COMBO_BACK_BANK = $("#splBackBankNoId").ligerComboBox({
      width: 300,
      selectBoxWidth: 300,
      selectBoxHeight: 240,
      valueField: 'id',
      textField: 'accNo',
      isMultiSelect: true,
      isSingleCheck: true,
      grid: getBankNoGridOptions(true),
      delayLoadGrid: false
  });
  
  function getBankNoGridOptions(checkbox){
  	var splId =liger.get("splId").selectedValue;
      var options = {
          columns: [
              { display: 'id', name: 'id', minWidth: 150,hide:true },
              { display: '收款人', name: 'rcptUnt', 
          		render: function (rowdata, rowindex, value, column) { 
           		 value ==null?"":value;
           		var h = '';
           		if(rowdata.audStsCd){
           		  if(rowdata.audStsCd==FlowConstant.FLOW_CHECK_STATE_NON||rowdata.audStsCd==FlowConstant.FLOW_CHECK_STATE_IN){
	                    	h+='<i class="ico_flasher"></i>';
	                 }
           		}
                   h+=value;
                       return h;
           	},
            	  minWidth: 150 },
              { display: '对公/对私', name: 'bizTypCdNm', minWidth: 50 },
              { display: '收款账号', name: 'accNo', minWidth: 100 },
              { display: '开户银行', name: 'bkNm', minWidth: 150 },
              { display: '开户行号', name: 'bkNo', minWidth: 50 },
              
          ],
          switchPageSizeApplyComboBox: false,
          method: 'get',
          data:null,
          dataAction: 'local',
          root:'rows',
	        record:'total',
          pageSize: 10,
          usePagerOnLessPagesize: false,
          cssClass: "SMALL_grid",
         // checkbox: checkbox,
          isSingleCheck: true,
          frozen: false,
          isSelected: function (rowdata) {
              if (comboGrid_defaultValue3 == "") return false;
              var defaultItems = comboGrid_defaultValue3.split(";");
              if(!isInit_setSearchComboVal3) { //只在初始化时执行一次，在onAfterShowData后改变
                  for (var i = 0; i < defaultItems.length; i++) {
                      if(rowdata[COMBO_BACK_BANK.options.valueField] == defaultItems[i]) {
                          return true;
                      }
                  };
              };
              return false;
          },
          onAfterShowData: function (currentData) {
              if(!isInit_setSearchComboVal3) { //只在初始化时执行一次，在onAfterShowData后改变
              	COMBO_BANK.setInputValue(comboGrid_defaultValue3, comboGrid_defaultText3, true);
                  isInit_setSearchComboVal3 = true;
              }
          }
      };
      return options;
  }	
  
  
  
  
  
  
  function setSplBackBankShow(){
  	var isBckNo = $("#isBckNo").val();
  	if(isBckNo=='1'){
  		 $("#splBckBankAccDiv").show();
  	}
  	if(isBckNo=='0'){
  		 $("#splBckBankAccDiv").hide();
  	}
  }
	
function getSplAccNos(){
	getSplBankNo();
	getSplBackBankNo();
}
  
</script>
<div class="ClearLine"></div>
</body>
</html>
